<script setup>
// 表单ref
const ruleFormRef = ref(null)

// 接收值
const props = defineProps({
  // 列表数据 枚举 循环渲染
  data: {
    type: Array,
    default: () => [],
  },
})

// 表单绑定
const ruleForm = reactive({})

// 提交
const formSub = () => {
  return ruleForm
}

// 导出方法
defineExpose({
  formSub,
})
</script>

<template>
  <el-form ref="ruleFormRef" :model="ruleForm" label-width="120px" status-icon>
    <template v-for="(item, index) in props.data" :key="item.model + index">
      <el-form-item :label="item.label" v-if="item.type == '1'">
        <el-input
          clearable
          v-model="ruleForm[model]"
          :placeholder="`请输入${item.label}`"
        />
      </el-form-item>
      <el-form-item :label="item.label" v-if="item.type == '2'">
        <el-date-picker
          clearable
          v-model="value1"
          type="date"
          :placeholder="`请选择${item.label}`"
        />
      </el-form-item>
    </template>
  </el-form>
</template>
<style scoped lang="scss"></style>
